import random

# 石头剪刀布的小游戏
def play_game():
    print("欢迎来到石头剪刀布游戏")
    while True:
        print("请输入你的选择：1.石头 2.剪刀 3.布 0.结束游戏")
        user_choice = input()
        if user_choice == "1":
            user_choice = "石头"
        elif user_choice == "2":
            user_choice = "剪刀"
        elif user_choice == "3":
            user_choice = "布"
        elif user_choice == "0":
            print("游戏结束")
            break
        else:
            print("输入错误，请重新输入")
            continue
        print("你选择了：", user_choice)
        computer_choice = random.choice(["石头", "剪刀", "布"])
        print("电脑选择了：", computer_choice)
        if user_choice == computer_choice:
            print("平局")
        elif (user_choice == "石头" and computer_choice == "剪刀") or (user_choice == "剪刀" and computer_choice == "布") or (user_choice == "布" and computer_choice == "石头"):
            print("你赢了!")
        else:
            print("你输了!")


# 猜大小的游戏
def play_game1():
    print("欢迎来到猜大小游戏")
    while True:
        print("请输入你的选择：1.猜大小 2.结束游戏")
        user_choice = input()
        if user_choice == "1":
            user_choice = "猜大小"
        elif user_choice == "2":
            print("游戏结束")
            break
        else:
            print("输入错误，请重新输入")
            continue
        # 生成一个随机数
        random_number = random.randint(1, 100)
        # 让用户输入一个数字, 提示用户猜大了还是猜小了
        while True:
            user_number = input("请输入一个数字：")
            if user_number.isdigit():
                user_number = int(user_number)
                if user_number > random_number:
                    print("猜大了")
                elif user_number < random_number:
                    print("猜小了")
                else:
                    print("猜对了")
                    break
            else:
                print("输入错误，请重新输入")